/**
 * @Date 2025/1/3 9:47
 * @Created by 衡盛永
 */

package org.example.deploy.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultDto<T> {
    private int code;
    private String msg;
    private T data;

    // 获取成功地响应数据
    public static <T> ResultDto<T> success(String msg, T data) {
        return new ResultDto<>(200, msg, data);
    }

    // 获取失败地响应数据
    public static <T> ResultDto<T> error(int code, String message) {
        return new ResultDto<>(code, message, null);
    }
}
